<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitereview
 * @copyright  Copyright 2012-2013 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: _addToWishlist.tpl 6590 2013-04-01 00:00:00Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
 ?>

<?php 
	$baseUrl = $this->layout()->staticBaseUrl;
	$this->headLink()
        ->prependStylesheet($baseUrl . 'application/modules/Sitereview/externals/styles/style_sitereview.css');
?>

<?php $viewer_id = Engine_Api::_()->user()->getViewer()->getIdentity(); ?>
<?php if($viewer_id): ?>
  <?php echo $this->htmlLink(array('route' => "sitereview_wishlist_general", 'action' => 'add', 'listing_id' => $this->item->listing_id), $this->translate($this->text), array('class' => "smoothbox $this->classIcon $this->classLink", 'title' => $this->translate('Add to Wishlist'))) ?>
<?php else: ?>
  <?php 
    $urlO = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
    $request_url = explode('/',$urlO);
    empty($request_url['2']) ? $param = 2 : $param = 1;
    $return_url = (!empty($_ENV["HTTPS"]) && 'on' == strtolower($_ENV["HTTPS"])) ? "https://":"http://";
    $currentUrl = urlencode($urlO);
  ?> 
  <?php 
  
  $addUrl = $this->url(array('action' => 'add', 'listing_id' => $this->item->listing_id, 'param' => $param,'request_url' => $request_url['1']), "sitereview_wishlist_general")."?"."return_url=".$return_url.$_SERVER['HTTP_HOST'].$currentUrl;
  echo $this->htmlLink($addUrl, $this->translate($this->text), array('class' => "$this->classIcon $this->classLink", 'title' => $this->translate('Add to Wishlist'))); ?>
<?php endif;?>
